﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Import Namespace="WebHoiChoMuaBan.Models" %>
<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Helpers" %>
<%@ Import Namespace="WebHoiChoMuaBan.Controllers.Utility" %>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadHolder" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#paging_container').pajinate({
                items_per_page: 9,
                nav_panel_id: '.page_navigation',
                nav_label_first: 'First',
                nav_label_last: 'Last',
                nav_label_prev: 'Trang trước',
                nav_label_next: 'Trang sau',
                abort_on_small_lists: true
            });
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            var right = $('#nbright').height();
            var left = $('#nbleft').height();
            if (left > right) {
                $('#nbright').height(left);
            }
            else {
                $('#nbleft').height(right);
            }

        });
    </script>
    <script>
        $(document).ready(function () {
            var triggers = $(".modalInput1").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            var triggers = $(".modalInput5").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            var buttons = $("#yesno1 button").click(function (e) {

                // get user input
                var yes = buttons.index(this) === 0;

                // do something with the answer
                triggers.eq(0).html("You clicked " + (yes ? "yes" : "no"));
            });

            $("#prompt1 form").submit(function (e) {

                // close the overlay
                triggers.eq(1).overlay().close();

                // get user input
                var input = $("input", this).val();

                // do something with the answer
                triggers.eq(1).html(input);

                // do not submit the form
                return e.preventDefault();
            });

            $("#prompt5 form").submit(function (e) {

                // close the overlay
                triggers.eq(1).overlay().close();

                // get user input
                var input = $("input", this).val();

                // do something with the answer
                triggers.eq(1).html(input);

                // do not submit the form
                return e.preventDefault();
            });

        });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ListMenuHeader" runat="server">
    <!-- Group list menu -->
    <div id="nbleft" style="float: left; width: 194px; background-color: #EEF2F5; border: 1px solid #d8dfea;">
        <img src='../Content/Images/hoi_bg_listmenu_nhadat.png' height="150px" width="150px"
            style="margin: 8px 8px 8px 20px" />
    </div>
    <div id="nbright" style="float: right; width: 80%; background-color: #eef2f5">
        <div class="hoicho_group_product">
            <div class="hoicho_header_feature">
                <ul>
                    <%
                        string bold = "style='font-weight: bold'";
                        PageType curPage = (PageType)ViewData["CurrentPage"];
                        Category curCate = (Category)ViewData["CurrentCategory"];
                        int needSell = (int)ViewData["NeedSell"];
                        int provinceId = (int)ViewData["ProvinceId"];

                        List<Category> cate = (List<Category>)ViewData["Categories"];
                        int i;
                        foreach (Category c in cate)
                        {
                            bool isCurrent = curCate != null &&
                                                ((curCate.ParentCategory != null && c.CateId == curCate.ParentCategory.CateId) ||
                                                 c.CateId == curCate.CateId);
                            Response.Write(string.Format("<li class='{0}'><a href='{1}?pid={2}&cid={3}&p={4}&need={5}&prvid={6}'>{7}</a></li>",
                                                        (isCurrent ? "selected_menu" : string.Empty),
                                                        Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                        curPage.PageId,
                                                        c.CateId,
                                                        1,
                                                        needSell,
                                                        provinceId,
                                                        c.CateName));
                        }
                    %>
                </ul>
            </div>
            <div class="hoicho_feature_content">
                <div class="private_breakpage_replycoment col_left reset_margin">
                    <%
                        Response.Write(string.Format("<a {0} href='{2}?pid={3}&cid={4}&p={5}&need={6}&prvid={8}'>Cần bán</a> | <a {1} href='{2}?pid={3}&cid={4}&p={5}&need={7}&prvid={8}'>Cần mua</a>",
                                                        (needSell == NewsProductHelper.NEED_SELL ? bold : string.Empty),
                                                        (needSell == NewsProductHelper.NEED_BUY ? bold : string.Empty),
                                                        Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                        curPage.PageId,
                                                        (curCate != null ? curCate.CateId : 0),
                                                        1,
                                                        NewsProductHelper.NEED_SELL,
                                                        NewsProductHelper.NEED_BUY,
                                                        provinceId));
                    %>
                </div>
                <div class="hoicho_select_province col_right">
                    <span class="hoicho_margin_right">
                        <%
                            StringBuilder provLinks = new StringBuilder();
                            provLinks.Append("<a {0} href='{4}?pid={5}&cid={6}&p={7}&need={8}&prvid=2'>Hà Nội</a> | ");
                            provLinks.Append("<a {1} href='{4}?pid={5}&cid={6}&p={7}&need={8}&prvid=6'>Hải Phòng</a> | ");
                            provLinks.Append("<a {2} href='{4}?pid={5}&cid={6}&p={7}&need={8}&prvid=3'>Hồ Chí Minh</a> | ");
                            provLinks.Append("<a {3} href='{4}?pid={5}&cid={6}&p={7}&need={8}&prvid=5'>Đà Nẵng</a> |");
                            Response.Write(string.Format(provLinks.ToString(),
                                                    (provinceId == 2 ? bold : string.Empty), // {0}
                                                    (provinceId == 6 ? bold : string.Empty), // {1}
                                                    (provinceId == 3 ? bold : string.Empty), // {2}
                                                    (provinceId == 5 ? bold : string.Empty), // {3}
                                                    Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                    curPage.PageId,
                                                    (curCate != null ? curCate.CateId : 0),
                                                    1,
                                                    needSell // buy or sell
                                                    ));
                        %>
                    </span><span>
                        <%
                            string selected = "class='highlight'";
                        %>
                        <button class="modalInput1 buttonpro" rel="#prompt1">
                            Tỉnh Khác</button>
                        <script type="text/javascript">
                            $("a[title]").tooltip();
                        </script>
                        <%--</select>--%>
                        <div class="modalpro" id="prompt1">
                            <button type="button" class="close" style="float: right; border: none; cursor: pointer">
                                Đóng
                            </button>
                            <br />
                            <table>
                                <tr>
                                    <%
                                        List<Province> provinces = (List<Province>)ViewData["Provinces"];
                                        int k = 0;

                                        foreach (Province pr in provinces)
                                        {
                                            //Response.Write(string.Format("<option value='{0}' {2}>{1}</option>", 
                                            //                            pr.ProvId, 
                                            //                            pr.ProvName,
                                            //                            (provinceId == pr.ProvId ? selected : string.Empty)
                                            //                            ));
                                    %>
                                    <td>
                                        <%Response.Write(string.Format("<a {7} href='{0}?pid={1}&cid={2}&p={3}&need={4}&prvid={5}'>{6}</a>", Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }), curPage.PageId, (curCate != null ? curCate.CateId : 0), 1, needSell, pr.ProvId, pr.ProvName, pr.ProvHighlight == 1 ? selected : String.Empty)); %>
                                    </td>
                                    <%
k++;
if (k % 3 == 0)
{
                                    %>
                                </tr>
                                <tr>
                                    <%
}
                                    %>
                                    <%
}
                                    %>
                                </tr>
                            </table>
                        </div>
                        <%--   <script type="text/javascript">
                            jQuery("#cbbProvince").change(function () {
                                location.href=<%=string.Format("'{0}?pid={1}&cid={2}&p={3}&need={4}'",
                                                    Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                    curPage.PageId,
                                                    (curCate != null ? curCate.CateId : 0),
                                                    1,
                                                    needSell // buy or sell
                                                    ) %> + '&prvid=' + jQuery(this).val();
                            });
                        </script>--%>
                    </span>
                </div>
            </div>
            <%
                //int j = 1;
                //foreach (Category c in cate)
                {
                    //Response.Write(string.Format("<div id='cate_{1}' class='hoicho_group_listmenu_fation page_{2}' {0}>", (j>1 ? "style='display:none'" : string.Empty), c.CateId, c.PageId));
                    Response.Write("<div>");
                    //j++;

                    if (curCate != null)
                    {
                        List<CategoryHelper.SubCategory> subcategories = null;
                        if (curCate.SubCategories != null && curCate.SubCategories.Count > 0)
                        {
                            //Số dòng mỗi cột
                            subcategories = (from sub in curCate.SubCategories
                                             select new CategoryHelper.SubCategory
                                             {
                                                 id = sub.CateId,
                                                 name = sub.CateName
                                             }).ToList();
                        }
                        else if (curCate.ParentCategory != null)
                        {
                            subcategories = (from sub in curCate.ParentCategory.SubCategories
                                             select new CategoryHelper.SubCategory
                                             {
                                                 id = sub.CateId,
                                                 name = sub.CateName
                                             }).ToList();
                        }

                        if (subcategories != null)
                        {
                            int perRow = (int)Math.Ceiling((double)subcategories.Count / 4);

                            //4 cột subcategories
                            for (i = 0; i < 4; i++)
                            {
                                var subCate = (from sub in subcategories select sub).Skip(perRow * i).Take(perRow);
                                if (subCate != null)
                                {
                                    Response.Write("<div class='private_menu_list_product'><ul>");
                                    foreach (var s in subCate)
                                        Response.Write(string.Format("<li><img src='../Content/Images/arrow_listproduct.gif'/><a href='{0}?pid={1}&cid={2}&p={3}' style='font-weight: {4}'>{5}</a></li>",
                                                                        Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                                        curPage.PageId,
                                                                        s.id,
                                                                        1,
                                                                        ((curCate != null && curCate.CateId == s.id) ? "bold" : "normal"),
                                                                        s.name));
                                    Response.Write("</ul></div>");
                                }
                            }
                        }
                    }
                    Response.Write("</div>");
                }
            %>
        </div>
    </div>
    <div class="clr">
    </div>
    <!-- End Group list menu -->
</asp:Content>
<%--end List Menu Header--%>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentHolder" runat="server">
    <script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js">
    </script>
    <!-- Group list menu -->
    <%--  <div class="hoicho_group_product">
        <div class="hoicho_header_feature">
            <ul>
            <%
                PageType curPage = (PageType)ViewData["CurrentPage"];
                Category curCate = (Category)ViewData["CurrentCategory"];
                    
                List<Category> cate = (List<Category>)ViewData["Categories"];
                int i;
                foreach(Category c in cate)
                {
                    bool isCurrent = curCate != null && 
                                        ((curCate.ParentCategory != null && c.CateId == curCate.ParentCategory.CateId) || 
                                            c.CateId == curCate.CateId);
                    //Response.Write(string.Format("<li class='page_{3} {0}'><a href='#' onclicked='switchTab({3}, this); return false;' rel='cate_{2}' >{1}</a></li>", ((curCate != null && c.CateId == curCate.ParentCategory.CateId) || (curCate == null && i == 1) ? "selected_menu" : string.Empty), c.CateName, c.CateId, c.PageId));
                    Response.Write(string.Format("<li class='{0}'><a href='{1}?pid={2}&cid={3}&p={4}'>{5}</a></li>", 
                                                (isCurrent ? "selected_menu" : string.Empty), 
                                                Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                curPage.PageId,
                                                c.CateId,
                                                1,
                                                c.CateName));
                }
                %>
            </ul>
        </div>
        <div class="hoicho_feature_content">
            <div class="private_breakpage_replycoment col_left reset_margin">
                <a href="#" class="selected_menu">Cần mua</a> | <a href="#">Cần bán</a>
            </div>
            <div class="hoicho_select_province col_right">
                <span class="hoicho_margin_right">
                    <a href="#">Hà nội</a> | 
                    <a href="#">Hải phòng</a> | 
                    <a href="#">Hồ chí minh</a> | 
                    <a href="#">Đà nẵng</a> | 
                </span>
                <span>
                    <select id="Select1" class="hoicho_input_select_province">
                        <option>Tỉnh khác</option>
                    </select>
                </span>
            </div>
        </div>
            
            <%
                //int j = 1;
                //foreach (Category c in cate)
                {
                    //Response.Write(string.Format("<div id='cate_{1}' class='hoicho_group_listmenu_fation page_{2}' {0}>", (j>1 ? "style='display:none'" : string.Empty), c.CateId, c.PageId));
                    Response.Write("<div>");
                    //j++;
                        
                    if (curCate != null)
                    {
                        List<CategoryHelper.SubCategory> subcategories = null;
                        if (curCate.SubCategories != null && curCate.SubCategories.Count > 0)
                        {
                            //Số dòng mỗi cột
                            subcategories = (from sub in curCate.SubCategories
                                                select new CategoryHelper.SubCategory
                                                {
                                                    id = sub.CateId,
                                                    name = sub.CateName
                                                }).ToList();
                        }
                        else
                        {
                            subcategories = (from sub in curCate.ParentCategory.SubCategories
                                                select new CategoryHelper.SubCategory
                                                {
                                                    id = sub.CateId,
                                                    name = sub.CateName
                                                }).ToList();
                        }
                        int perRow = (int)Math.Ceiling((double)subcategories.Count / 4);

                        //4 cột subcategories
                        for (i = 0; i < 4; i++)
                        {
                            var subCate = (from sub in subcategories select sub).Skip(perRow * i).Take(perRow);
                            if (subCate != null)
                            {
                                Response.Write("<div class='private_menu_list_product'><ul>");
                                foreach (var s in subCate)
                                    Response.Write(string.Format("<li><a href='{0}?pid={1}&cid={2}&p={3}' style='font-weight: {4}'>{5}</a></li>",
                                                                    Url.Action("Page", "Home", new { pageName = MiscUtil.EscapeString(curPage.PageName) }),
                                                                    curPage.PageId,
                                                                    s.id,
                                                                    1,
                                                                    ((curCate != null && curCate.CateId == s.id) ? "bold" : "normal"),
                                                                    s.name));
                                Response.Write("</ul></div>");
                            }
                        }
                    }
                    Response.Write("</div>");
                }
                %>
    </div>--%>
    <!-- End Group list menu -->
    <!-- Chi tiet san pham -->
    <%
        NewsProduct news = (NewsProduct)ViewData["News"];
        List<NewsProductThumb> thumbs = null;

        if (news.NewsProductThumbs != null)
            thumbs = news.NewsProductThumbs.ToList();
    %>
    <div class="hoicho_group_product reset_border bg_reset">
        <div class="hoicho_group_detaitsp col_left hoi hoicho_margin_right private_group_friend ">
            <div class="private_friend_middle" style="width: 272px; height: 212px">
                <% if (thumbs != null && thumbs.Count > 0)
                   { %>
                <img src="/../Content/Images/Upload/<%=thumbs[0].NProThumbName %>" class="modalInput5"
                    style="cursor: pointer" align="center" rel="#prompt5" alt="" width="181" height="212" /></div>
            <% }
                   else
                   {
            %>
            <img src="/../Content/Images/no-image.gif" align="center" alt="" width="181" height="212" /></div>
        <%
            } %>
        <div class="hoicho_margin_leftright" style="width: 270px; height: 54px">
            <% 
                int i = 1;
                for (i = 1; thumbs.Count > 1 && i < thumbs.Count; i++)
                { %>
            <div class="hoicho_thumb_spdetail">
                <a href="#image">
                    <img src="/../Content/Images/Upload/<%=thumbs[i].NProThumbName %>" width="42" height="42"
                        alt="" /></a>
            </div>
            <% } %>
            <script type="text/javascript">
                $(document).ready(function () {
                    $(".hoicho_thumb_spdetail").mouseover(function () {
                        var source = $(this).find("img").attr("src");
                        $(".private_friend_middle").find("img").attr("src", source);
                        $(".modal5").find("img").attr("src", source);
                    });
                });
            </script>
            <%--begin modal pop up --%>
            <div class="modal5" id="prompt5">
                <center>
                <%if (thumbs != null & thumbs.Count > 0)
                  { %>
                    <img src="/../Content/Images/Upload/<%=thumbs[0].NProThumbName %>" align="center"
                        alt="" />
                        <%}
                  else
                  {
                     %>
                     <img src="/../Content/Images/no-image.gif" />
                     <%
                  } %>
                </center>
                <center>
                    <br />
                    <br />
                    <%-- <input type="button" id="Button1" class="private_bt_submit_news" value="Gởi"
                            data-url='<%=news.NProId %>' />--%>
                    <button type="button" class="close private_bt_submit_news">
                        Đóng
                    </button>
                </center>
                </form>
                <br />
            </div>
            <%--end modal popup--%>
            <%--<div class="hoicho_thumb_spdetail">
                    <a href="#">
                        <img src="/../Content/Images/iphone_thumb.jpg" /></a>
                </div>--%>
            <%-- <div class="clear">
                </div>--%>
        </div>
    </div>
    <!-- Col_right Chi tiet san pham -->
    <%--<div class="col_left hoicho_detail_sp_right">--%>
    <div class="col_left hoicho_detail_sp_right">
        <div class="private_comment_top">
            <div class="private_post_text">
                <p class="private_text_title">
                    <%=news.NProTitle %>
                </p>
                <p>
                    <span class="private_price">Giá:
                        <%=news.NProPrice %>
                        <%=news.NProPriceUnit %></span> <span class="private_price_cur">VND</span> <span
                            class="private_price_cur">SJC</span> <span class="private_price_cur">USD</span>
                    <span>
                        <img src="/../Content/Images/hoicho_bt_goldmember.gif" /></span>
                </p>
                <div class="clear">
                </div>
                <p class="font_bold" style="color: #4489b2">
                    <%=news.Member.MemCompany %>
                </p>
                <p>
                    Hãng Sản xuất:<%=news.NProFrom %>
                </p>
                <p>
                    Địa chỉ:
                    <%=news.Member.MemAddress %><br />
                    Nơi đăng:
                    <%=news.Province.ProvName %><br />
                    Lược xem:
                    <%=news.NProViewCount %>
                </p>
                <p class="private_text_title">
                    <%=news.Member.MemCompany %></p>
                <p>
                    Địa chỉ :
                    <div id="memAddLat" class="hidden">
                        <%=news.Member.MemAddressLatitude %></div>
                    <div id="memAddLong" class="hidden">
                        <%=news.Member.MemAddressLongitude %></div>
                    Điện thoại:
                    <%=news.Member.MemHomePhone %>
                    -
                    <%=news.Member.MemCellPhone %><br />
                    Fax :
                    <%=news.Member.MemFax %><br />
                    Website :
                    <%=news.Member.MemWebSite %><br />
                    Email:
                    <%=news.Member.MemEmail %>
                    <br />
                    <div class="LikeField">
                        Thích: Có
                        <%=news.NProLike %>
                        người thích
                    </div>
                </p>
            </div>
            <div class="clear">
            </div>
            <div class="hoicho_margin_topbottom">
                <%--<div class="col_left hoicho_margin_right">--%>
                <div class=" col_left">
                    <a href="#" class="hoicho_bt_action" id="LikeButton" data-url='<%=news.NProId %>'>
                        <img class="hoicho_bt_action_image " style="cursor: pointer" align="middle" src="/../Content/Images/like_bt.gif" />
                        Thích</a>
                    <script type="text/javascript">
                        $('#LikeButton').click(function () {
                            var sid = $('#LikeButton').data("url");
                            $.ajax({
                                type: "POST",
                                url: "/NewsProduct/Like",
                                data: "proId=" + sid,
                                success: function (result) {

                                    if (result == "null") {
                                        alert("Đăng nhập để thích");
                                    }
                                    else {
                                        if (result == "duplicated")
                                            alert("Bạn đã thích rồi");
                                        else
                                            $('.LikeField').html("Thích: Có " + result + " người thích");
                                    }
                                },
                                error: function (req, status, error) {
                                    alert("Sorry! We could not receive your feedback at this time.");
                                }
                            });
                        });
                    </script>
                </div>
                <div class="col_left">
                    <%--<div>--%>
                    <a href="#" class="hoicho_bt_action  modalInput2" rel="#prompt2">
                        <img class="hoicho_bt_action_image" src="/../Content/Images/hoicho_iconmap.gif" align="bottom" />
                        Bản đồ gian hàng </a>
                </div>
                <div class="col_left">
                    <%--<div>--%>
                    <a href="#" class="hoicho_bt_action modalInput" rel="#prompt">
                        <img class="hoicho_bt_action_image " src="/../Content/Images/icon_mail.gif" align="bottom" />
                        Liên hệ mail </a>
                </div>
                <%--begin modal pop up --%>
                <div class="modal" id="prompt">
                    <h2>
                        Thông tin liên hệ</h2>
                    <p>
                        Thông tin này sẽ được gởi mail tới chủ gian hàng
                    </p>
                    <!-- input form. you can press enter too -->
                    <form>
                    <table>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <%=Html.TextBox("txtUserId", (Session["MemId"] == null ? "" : Session["MemId"]), new { @class = "lienhe-box hidden" })%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Họ và tên:
                            </td>
                            <td>
                                <%=Html.TextBox("txtUserName", (Session["MemUserName"] == null ? "" : Session["MemUserName"]), new { @class = "lienhe-box" })%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Địa chỉ Email:
                            </td>
                            <td>
                                <%=Html.TextBox("txtUserEmail", (Session["MemUserEmail"] == null ? "" : Session["MemUserEmail"]), new { @class = "lienhe-box" })%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Nội dung:
                            </td>
                            <td>
                                <%=Html.TextArea("txtUserNoiDung", "", new { @class = "lienhe-textarea" })%>
                            </td>
                        </tr>
                    </table>
                    <center>
                        <input type="button" id="LienHeButton" class="private_bt_submit_news" value="Gởi"
                            data-url='<%=news.NProId %>' />
                        <button type="button" class="close private_bt_submit_news">
                            Cancel
                        </button>
                    </center>
                    </form>
                    <br />
                </div>
                <%--end modal popup--%>
                <%--begin modal map--%>
                <div class="modal2" id="prompt2">
                    <h2>
                        Thông tin Map</h2>
                    <!-- input form. you can press enter too -->
                    <form>
                    <button type="button" style="margin: 5px;" class="close private_bt_submit_news">
                        Đóng
                    </button>
                    <div id="map_canvas" onclick="calcRoute()" style="top: 10px; height: 450px; width: 100%">
                    </div>
                    </form>
                    <br />
                </div>
                <%--end modal map--%>
                <div class="col_left">
                    <%--<div>--%>
                    <a href="#" class="hoicho_bt_action" onclick="SaveNews(<%=news.NProId %>)">
                        <img class="hoicho_bt_action_image" src="/../Content/Images/icon_save.gif" align="bottom" />
                        Lưu tin </a>
                </div>
                <div class="col_left">
                    <a href="#" class="hoicho_bt_action" onclick="window.print();return false;">
                        <img class="hoicho_bt_action_image" src="/../Content/Images/icon_print.gif" align="bottom" />
                        In </a>
                </div>
                <div class="clear">
                </div>
                <%--<div class="content_group">--%>
                <div>
                    <div class="private_logo_share col_left hoicho_margin_right">
                        <!-- AddToAny BEGIN -->
                        <div class="a2a_kit a2a_default_style">
                            <a class="a2a_dd" href="http://www.addtoany.com/share_save?linkurl=hoichomuaban.com&amp;linkname=Hoi%20Cho%20Mua%20Ban">
                                Chia sẻ</a> <span class="a2a_divider"></span><a class="a2a_button_facebook">
                            </a><a class="a2a_button_twitter"></a><a class="a2a_button_google_bookmarks"></a>
                            <a class="a2a_button_digg"></a>
                            <!-- AddToAny END -->
                        </div>
                    </div>
                    <div class="col_left hoicho_margin_topbottom">
                        <%
                            Response.Write(string.Format("<a href='{0}'>", Url.RouteUrl("PrivateDefaultRoute", new { uid = news.MemId, isEditMode = false })));
                        %>
                        <img src="/../Content/Images/hoicho_bt_view_showroom_1.png" alt="" /></a></div>
                </div>
                <div class="clear">
                </div>
                <div class="hoicho_margin_topbottom">
                    <%--<div class="content_group hoicho_margin_topbottom">--%>
                    <span class="hoicho_margin_right font_bold">
                        <img src="/../Content/Images/hoicho_icon_by.gif" class="hoicho_margin_right" />Đăng
                        bởi:
                        <%=news.Member.MemUsername %></span> <strong>Chat:&nbsp;</strong> <a href="ymsgr:sendim?huynhlongho.cntt">
                            <img width="80" height="16" alt="huynhlongho.cntt" src="http://opi.yahoo.com/online?u=huynhlongho.cntt&m=g&t=1" />
                        </a><a href="skype:thanhtamth8b?chat">
                            <img src="http://mystatus.skype.com/bigclassic/thanhtamth8b" style="border: none;"
                                width="90" height="24" alt="My status" /></a>
                </div>
            </div>
        </div>
        <!-- End col right chi tiet san pam -->
    </div>
    </div>
    <p class="private_price">
        Mô tả sản phẩm chi tiết</p>
    <br />
    <p>
        <%=news.NProContent %>
    </p>
    <!-- End chi tiet san pham -->
    <!-- San pham cung ng dang -->
   
    <div class="hoicho_group_product bg_reset" style="margin-top: 10px;">
        <div class="hoicho_header_feature content_group">
        <div style="float:left">
            <ul class="tabs">
                <%--   <li><a href="#">
                    <%=news.Category.CateName %>
                </a></li>--%>
                <li class="selected_menu"><a href="#" class="selected_menu">SP cùng người đăng</a></li>
                <li><a href="#">SP cùng danh mục</a></li>
                <li><a href="#">SP cùng mức giá</a></li>
                <li><a href="#">Tất cả</a></li>
            </ul>
            </div>
                 <div style="float:right;cursor:pointer" id="toggle"><img src="../Content/Images/collapse.png" width="20" height="20"/></div>
                  <div class="clr"></div>
        </div>
        <div class="clear">
        </div>
        <!-- thumb product same post -->
        <div class="panes">
            <div class="">
                <% int tcount = 0;
                   NewsProductHelper productHelper = new NewsProductHelper();
                   NewsProductThumbHelper productThumbHelper = new NewsProductThumbHelper();
                   //List<NewsProduct> listNews = productHelper.getProductByCategory(news.CateId);
                   List<NewsProduct> listNews = productHelper.getProductByMem(news.MemId);
                   if (listNews != null)
                   {
                       tcount = 0;
                       Response.Write("<table>");
                       Response.Write("<tr>");
                       foreach (NewsProduct pro in listNews)
                       {
                           Response.Write("<td>");
                           NewsProductThumb proThumb = productThumbHelper.getProductMainThumbById(pro.NProId);
                           string link = string.Format("<a href='{0}?prid={1}'>",
                                    Url.Action("Detail", "NewsProduct", new { productTitle = MiscUtil.EscapeString(pro.NProTitle) }),
                                    pro.NProId
                                    );
                %>
                <%
                    Response.Write("<td style='margin:5px;'>");
                %>
                <%=link %>
                <%
if (proThumb != null)
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/Upload/{0}' alt=''", proThumb.NProThumbName));
else
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/{0}' alt=''", "no-image.gif"));
Response.Write("</br><p class=''>");
if (pro.NProTitle.Length > 35)
{
    pro.NProTitle = pro.NProTitle.Substring(0, 32) + "...";
}
else
{
    int iCount = 35 - pro.NProTitle.Length;
    for (int k = 0; k < iCount; k++)
    {
        pro.NProTitle += " ";
    }
}
Response.Write("<center>");
Response.Write(string.Format("<p style='width:130px;height:40px;font-size:14px !important;' href='#'>{0} </p>", pro.NProTitle));
Response.Write("</p>");
if (pro.NProPrice == null)
{
    pro.NProPrice = 0;
}
if (pro.NProPriceUnit == null)
    pro.NProPriceUnit = "VND";
Response.Write(string.Format(" <p class='private_price' style='font-size:12px;color:red;'>{0}{1}</p>", pro.NProPrice, pro.NProPriceUnit));
Response.Write("</center>");
Response.Write("</td>");
tcount++;
if (tcount % 5 == 0)
{
    Response.Write("</tr>");
    Response.Write("<tr>");
}
                   }
                   Response.Write("<tr>");
                   Response.Write("</table>");
                    }
                    else
                    {
                        Response.Write("Không tồn tại");
                    }
                %>
            </div>
            <div>
                <%
                    List<NewsProduct> ListNewsSameMem = productHelper.getProductByCategory(news.CateId);
                    //List<NewsProduct> ListNewsSameMem = productHelper.getProductByMem(news.MemId);
                    if (ListNewsSameMem != null)
                    {
                        tcount = 0;
                        Response.Write("<table>");
                        Response.Write("<tr>");

                        foreach (NewsProduct pro in ListNewsSameMem)
                        {
                            Response.Write("<td>");
                            NewsProductThumb proThumb = productThumbHelper.getProductMainThumbById(pro.NProId);
                            string link = string.Format("<a href='{0}?prid={1}'>",
                                     Url.Action("Detail", "NewsProduct", new { productTitle = MiscUtil.EscapeString(pro.NProTitle) }),
                                     pro.NProId
                                     );
                %>
                <%
                    Response.Write("<td style='margin:5px;'>");
                %>
                <%=link %>
                <%
                        
if (proThumb != null)
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/Upload/{0}' alt=''", proThumb.NProThumbName));
else
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/{0}' alt=''", "no-image.gif"));
Response.Write("</br><p class=''>");
if (pro.NProTitle.Length > 35)
{
    pro.NProTitle = pro.NProTitle.Substring(0, 32) + "...";
}
else
{
    int iCount = 35 - pro.NProTitle.Length;
    for (int k = 0; k < iCount; k++)
    {
        pro.NProTitle += " ";
    }
}
Response.Write("<center>");
Response.Write(string.Format("<p style='width:130px;height:40px;font-size:14px !important;' href='#'>{0} </p>", pro.NProTitle));
Response.Write("</p>");
if (pro.NProPrice == null)
{
    pro.NProPrice = 0;
}
if (pro.NProPriceUnit == null)
    pro.NProPriceUnit = "VND";
Response.Write(string.Format(" <p class='private_price' style='font-size:12px'>{0}{1}</p>", pro.NProPrice, pro.NProPriceUnit));
Response.Write("</center>");
Response.Write("</td>");
tcount++;
if (tcount % 5 == 0)
{
    Response.Write("</tr>");
    Response.Write("<tr>");
}
                    }
                    Response.Write("<tr>");
                    Response.Write("</table>");
                    }
                    else
                    {
                        Response.Write("Không tồn tại");
                    }
                %>
            </div>
            <div>
                <%
                    List<NewsProduct> ListNewsSameType = productHelper.getProductByPrice(news.NProPrice);
                    //List<NewsProduct> ListNewsSameType = productHelper.getProductByType(news.NProNeedType);
                    if (ListNewsSameType != null)
                    {
                        tcount = 0;
                        Response.Write("<table>");
                        Response.Write("<tr>");
                        foreach (NewsProduct pro in ListNewsSameType)
                        {
                            NewsProductThumb proThumb = productThumbHelper.getProductMainThumbById(pro.NProId);
                            string link = string.Format("<a href='{0}?prid={1}'>",
                                     Url.Action("Detail", "NewsProduct", new { productTitle = MiscUtil.EscapeString(pro.NProTitle) }),
                                     pro.NProId
                                     );
                %>
                <%
                    Response.Write("<td style='margin:5px;'>");
                %>
                <%=link%>
                <%
if (proThumb != null)
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/Upload/{0}' alt=''", proThumb.NProThumbName));
else
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/{0}' alt=''", "no-image.gif"));
Response.Write("</br><p class=''>");
if (pro.NProTitle.Length > 35)
{
    pro.NProTitle = pro.NProTitle.Substring(0, 32) + "...";
}
else
{
    int iCount = 35 - pro.NProTitle.Length;
    for (int k = 0; k < iCount; k++)
    {
        pro.NProTitle += " ";
    }
}
Response.Write("<center>");
Response.Write(string.Format("<p style='width:130px;height:40px;font-size:14px !important;' href='#'>{0} </p>", pro.NProTitle));
Response.Write("</p>");
if (pro.NProPrice == null)
{
    pro.NProPrice = 0;
}
if (pro.NProPriceUnit == null)
    pro.NProPriceUnit = "VND";
Response.Write(string.Format(" <p class='private_price' style='font-size:12px'>{0}{1}</p>", pro.NProPrice, pro.NProPriceUnit));
Response.Write("</center>");
Response.Write("</td>");
tcount++;
if (tcount % 5 == 0)
{
    Response.Write("</tr>");
    Response.Write("<tr>");
}
                        }
                        Response.Write("<tr>");
                        Response.Write("</table>");
                    }
                    else
                    {
                        Response.Write("Không tồn tại");
                    }
                    
                %>
            </div>
            <div>
                <%
                    List<NewsProduct> ListNewsSamePrice = productHelper.getProductAll();
                    if (ListNewsSamePrice != null)
                    {
                        tcount = 0;
                        Response.Write("<table>");
                        Response.Write("<tr>");

                        foreach (NewsProduct pro in ListNewsSamePrice)
                        {
                            Response.Write("<td>");
                            NewsProductThumb proThumb = productThumbHelper.getProductMainThumbById(pro.NProId);
                            string link = string.Format("<a href='{0}?prid={1}'>",
                                     Url.Action("Detail", "NewsProduct", new { productTitle = MiscUtil.EscapeString(pro.NProTitle) }),
                                     pro.NProId
                                     );
                %>
                <%
                    Response.Write("<td style='margin:5px;'>");
                %>
                <%=link %>
                <%
if (proThumb != null)
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/Upload/{0}' alt=''", proThumb.NProThumbName));
else
    Response.Write(String.Format("<img  width='130px' height='90px' src = '/../Content/Images/{0}' alt=''", "no-image.gif"));
Response.Write("</br><p class=''>");
if (pro.NProTitle.Length > 35)
{
    pro.NProTitle = pro.NProTitle.Substring(0, 32) + "...";
}
else
{
    int iCount = 35 - pro.NProTitle.Length;
    for (int k = 0; k < iCount; k++)
    {
        pro.NProTitle += " ";
    }
}
Response.Write("<center>");
Response.Write(string.Format("<p style='width:130px;height:40px;font-size:14px !important;' href='#'>{0} </p>", pro.NProTitle));
Response.Write("</p>");
if (pro.NProPrice == null)
{
    pro.NProPrice = 0;
}
if (pro.NProPriceUnit == null)
    pro.NProPriceUnit = "VND";
Response.Write(string.Format(" <p class='private_price' style='font-size:12px'>{0}{1}</p>", pro.NProPrice, pro.NProPriceUnit));
Response.Write("</center>");
Response.Write("</td>");
tcount++;
if (tcount % 5 == 0)
{
    Response.Write("</tr>");
    Response.Write("<tr>");
}
                        }
                        Response.Write("<tr>");
                        Response.Write("</table>");
                    }
                    else
                    {
                        Response.Write("Không tồn tại");
                    }
                %>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            // setup ul.tabs to work as tabs for each div directly under div.panes
            $("ul.tabs").tabs("div.panes > div ");
        });
        $('#toggle').click(function () {
            $('.panes').toggle("slow");
        });
    </script>
    <!-- end sanpham cung ng dang -->
    <div class="private_coment_group">
        <div class="private_coment_text">
            <a name="comments">Bình luận</a>
        </div>
        <% if (Session["MemId"] != null)
           { %>
        <form action="<%=Url.Action("AddComment", "NewsProduct") %>" method="post" class="private_content_comment">
        <input type="hidden" value="<%=news.NProId %>" name="newsId" id="newsId" />
        <div class="private_menu_topmenu">
            <textarea class="input_full" rows="5" cols="45" style="width: 720px" id="txtComment"
                name="txtComment"></textarea>
        </div>
        <div class="private_post_text">
            <div style="background-color: White; margin-top: 5px">
                <span class="private_font_bold">Chọn icon: </span>
                <% ChatHelper chat = new ChatHelper();
                   List<ChatEmotionDetail> icons = chat.getEmotionPath();
                   foreach (ChatEmotionDetail icon in icons)
                   {
                       Response.Write("<img align='middle' onclick='MemchatIconClick(this)' src='" + icon.path + "' id='" + icon.notation + "' width='40px' height='40px' />");

                   }
                %>
                <script type="text/javascript">
                    function MemchatIconClick(obj) {
                        $this = document.getElementById("txtComment");
                        $this.value += obj.id;
                    }
                </script>
            </div>
            <div style="margin-left: 250px;">
                <input type="submit" style="width: 60px;" id="" value="Gửi" class="private_bt_submit_news_disable" />
            </div>
        </div>
        </form>
        <% } %>
    </div>
    <form action="<%=Url.Action("AddComment", "NewsProduct") %>" method="post" class="private_content_comment"
    style="margin-left: auto; display: none" id="frmReplyTo">
    <input type="button" value="đóng" style="margin-left: 400px" class="btnReplyClose_<%=news.NProId %>"
        onclick="CloseRegisterReplyButton(<%=news.NProId %>)" />
    <input type="hidden" value="" name="replyTo" id="replyTo" />
    <input type="hidden" value="<%=news.NProId %>" name="newsId" id="Hidden1" />
    <div class="private_menu_topmenu">
        <textarea class="input_full" rows="5" cols="45" id="ChatArea" style="width: 500px"
            name="txtComment"></textarea>
    </div>
    <div class="private_post_text">
        <div style="margin-top: 5px; background-color: white;">
            <span class="private_font_bold">Chọn icon: </span>
            <% ChatHelper nchat = new ChatHelper();
               List<ChatEmotionDetail> nicons = nchat.getEmotionPath();
               foreach (ChatEmotionDetail icon in nicons)
               {
                   Response.Write("<img align='middle' onclick='chatIconClick(this)' src='" + icon.path + "' id='" + icon.notation + "' width='40px' height='40px' />");

               }
            %>
            <script type="text/javascript">
                function chatIconClick(obj) {
                    $this = document.getElementById("ChatArea");
                    $this.value += obj.id;
                }
            </script>
        </div>
        <div style="margin-left: 200px">
            <input type="submit" style="width: 60px;" id="Submit1" value="Gửi" class="private_bt_submit_news_disable" />
        </div>
    </div>
    </form>
    <div class="clear">
    </div>
    <div id="paging_container" class="container">
        <div class="page_navigation private_breakpage" style="text-align: right">
        </div>
        <ul class="content">
            <%
                //List<NewsProductComment> comments = (from n in news.NewsProductComments
                //                                     where n.ComIdReply == null
                //                                     orderby n.ComDate descending
                //                                     select n).ToList();
                List<NewsProductComment> comments = productHelper.getListCommentByProductId(news.NProId);
                foreach (var com in comments)
                {
            %>
            <!-- Content comment -->
            <li>
                <div class="private_content_mg_thumb">
                    <div class="private_comment_repply">
                        <div class="private_comment_user">
                            <div class="private_img_post_bt">
                                <img class="private_img_post" alt="" width="50" height="50" src="/../Content/Images/Upload/<%=com.Member.MemAvatar %>" />
                            </div>
                            <div class="private_messages_text">
                                <div class="commentId" style="display: none">
                                    <%=com.ComId %></div>
                                <p>
                                    <span class="private_text_title">
                                        <%=com.Member.MemUsername %></span> &nbsp;&nbsp;<span class="private_timer_repply"><%=com.ComDate.ToString("HH:mm | dd.MM.yyyy") %></span></p>
                                <p>
                                    <%=com.ComContent %>
                                </p>
                                <%
                                    if (Session["MemId"] != null)
                                    { %>
                                <div class="private_link_repply">
                                    <a href="#" class="btnReply">Trả lời</a></div>
                                <%}
                                    else
                                    {
                                        Response.Write("<div class='private_link_repply'>");
                                        Response.Write("Đăng nhập để bình luận");
                                        Response.Write("</div>");
                                    }%>
                            </div>
                        </div>
                        <div class="clear">
                        </div>
                        <%
//List<NewsProductComment> replies = (from r in com.NewsProductReply
//                                    orderby r.ComDate descending
//                                    select r).ToList();
List<NewsProductComment> replies = productHelper.getListCommentReplyByCommentId(com.ComId);
foreach (NewsProductComment r in replies)
{
                        %>
                        <div class="private_admin_reply">
                            <div class="private_arrowtop_adminreply">
                            </div>
                            <div class="private_content_adminreply">
                                <div class="private_img_post_bt">
                                    <img class="private_img_post" alt="" width="50" height="50" src="/../Content/Images/Upload/<%=r.Member.MemAvatar %>" />
                                </div>
                                <div class="private_messages_text">
                                    <p>
                                        <span class="private_user">
                                            <%=r.Member.MemUsername %></span>&nbsp;&nbsp; <span class="private_timer_repply">
                                                <%=r.ComDate.ToString("HH:mm | dd.MM.yyyy") %></span></p>
                                    <p>
                                        <%=r.ComContent %>
                                    </p>
                                </div>
                            </div>
                        </div>
                        <% } %>
                    </div>
                    <hr class="private_color_hr" />
                </div>
                <!-- endContent comment -->
            </li>
            <% } %>
        </ul>
        <div class="page_navigation private_breakpage" style="text-align: right">
        </div>
    </div>
    <%-- <a href="#">
            <img src="/../Content/Images/arrow_breakpage_left.gif" alt="">&nbsp;Trang trước</a>
        <a href="#" class="menu_select">1</a> <a href="#">2</a> <a href="#">3</a> <a href="#">
            4</a> <a href="#">5</a> <a href="#">6</a> <a href="#">7</a> <a href="#">Trang sau&nbsp;<img
                src="/../Content/Images/arrow_breakpage_right.gif" alt=""></a>--%>
    <%--</div>--%>
</asp:Content>
